home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / Ext / GCSound / GCSound.gc < prev    next >
Encoding:
Gui4CLI script  |  1999-11-24  |  20.0 KB  |  816 lines

  1. G4C
  2.  
  3. WINBIG 40 11 226 84 'GCSound 8SVX Player'
  4. WinType 11110001
  5. resinfo 8 640 256
  6.  
  7. ; ===============================================================
  8. ;       general events
  9. ; ===============================================================
  10.  
  11. xOnLoad
  12.    mode = DIR                             ; can be SAMPLE or DIR
  13.    FAVFLAG = 0
  14.    selswitch = 0                          ; delect/deselect dir lv switch
  15.    setgad #this 10 hide                   ; hide the samples lv
  16.    setgad gcsound.gc 2 HIDE               ; and it's text box
  17.    setgad gcsound.gc 11 HIDE              ; the fav lv
  18.    extract gcsound.gc guipath mypath      ; save lists of files -
  19.    JoinFile $mypath Lists prefs           ; in my dir/Lists
  20.    joinfile $prefs List_1 prefs
  21.    GuiOpen #this
  22.    name = ''                              ; set these for safety
  23.    volume = 64
  24.    speed = -1
  25.    times = 0
  26.    status = IDLE
  27.    setwin = CLOSED
  28.    gcsound.set/oldspeed = -1
  29.    run 'guis:ext/gcsound/gcsound'         ; load extension
  30.  
  31. xOnClose
  32.    guiclose #this
  33.    setgad #this 5 on                      ; appicon on
  34.  
  35. xOnQuit
  36.    guiquit gcsound.pop
  37.    guiquit gcsound.dirpop
  38.    guiquit gcsound.set
  39.    call gcsound quit
  40.     ifexists port HIPPOPLAYER
  41.        sendrexx HIPPOPLAYER QUIT
  42.     endif
  43.  
  44. xOnRMB
  45.    if $mode = SAMPLE
  46.       guiopen gcsound.pop
  47.    else
  48.         if $FAVFLAG != 0
  49.             FAVFLAG = 0
  50.             lvuse #this 1
  51.             lvmode DIR
  52.             lvdir #$lastdir
  53.            setwintitle #this '$$lv.dir'
  54.             setgad #this 50 on
  55.         endif
  56.         guiopen gcsound.dirpop
  57.    endif
  58.  
  59. xAppicon -1 -1 :gcsound.gc 'GCSound' '' OFF
  60.    gadid 5
  61.    guiopen #this
  62.    setgad #this 5 off
  63.  
  64. xOnFail
  65.    guiwindow #this resume
  66.     setwintitle #this '* Error: $$retcode'
  67.  
  68. ; ===============================================================
  69. ;       the dir listview
  70. ; ===============================================================
  71.  
  72. XLISTVIEW 0 0 204 85 "" file "" 0 DIR
  73.    gadid 1
  74.     attr resize 0022
  75.    gadfont #mono 8 000
  76.    ; LVColors   2 1 3 2 ; uncomment this line for genlocking
  77.  
  78.     ; if this flag is set we're in fav choose mode..
  79.     if $FAVFLAG = 1
  80.         FAVFLAG = 0
  81.         cutvar file cut word -1 file
  82.         extract file clean file
  83.         lvmode DIR
  84.         lvdir #$file
  85.        setwintitle #this '$$lv.dir'
  86.         lastdir = $$lv.dir
  87.         setgad #this 50 on
  88.         stop
  89.     endif
  90.  
  91.     ; get file name for .mod checking
  92.     local fname    
  93.     extract file file fname
  94.  
  95.    ; on choosing a file by double click, play it..    
  96.    if $file H= 'FORM????8SVX'
  97.       call gcsound sound $file 0 64 -1
  98.  
  99.     ; check for module..
  100.     elseif $fname[-4][4] == .mod
  101.     or $fname[0][4] == mod.
  102.         ifexists port HIPPOPLAYER
  103.             sendrexx HIPPOPLAYER EJECT
  104.             sendrexx HIPPOPLAYER 'PLAY $file'
  105.        else
  106.           guiload guis:tools/rtn/filepop $file
  107.        endif
  108.  
  109.    else
  110.       guiload guis:tools/rtn/filepop $file
  111.    endif
  112.  
  113. xlvdirhook 1
  114.     lastdir = $$lv.dir
  115.     if $$lv.dir > ''
  116.        setwintitle #this '$$lv.dir'
  117.     else
  118.         setwintitle #this 'Disks'
  119.     endif
  120.  
  121. XLISTVIEW 0 0 204 85 "" favfile "" 0 MULTI        ; for favourites
  122.    gadid 11
  123.  
  124. ; ===============================================================
  125. ;       the samples listview - (should make it DBase)
  126. ; ===============================================================
  127.  
  128. XLISTVIEW 0 0 204 84 "" sample t:soundtemp 5 MULTI
  129.    gadid 10
  130.     attr resize 0022
  131.    gadfont #mono 8 000
  132.    ;LVColors   2 1 3 2        ; uncomment this line for genlocking
  133.  
  134.    gosub gcsound.gc splitline '$sample'
  135.    if $status = LOAD
  136.       call gcsound play $name $times $volume $speed
  137.       status = PLAY
  138.       gosub gcsound.gc joinline
  139.       lvput '$rec'
  140.    elseif $status = IDLE
  141.       call gcsound load $path $name
  142.       call gcsound play $name $times $volume $speed
  143.       status = PLAY
  144.       gosub gcsound.gc joinline
  145.       lvput '$rec'
  146.    endif
  147.    lvsort ASC
  148.  
  149. ; ===============================================================
  150. ;       dir lv control buttons
  151. ; ===============================================================
  152.  
  153. XBUTTON 206 0 20 12 "P"
  154.    gadid 50
  155.     attr resize 2000
  156.    lvuse #this 1
  157.    lvdir parent
  158.    setwintitle #this '$$lv.dir'
  159.  
  160. XBUTTON 206 12 20 12 "D"
  161.    gadid 50
  162.     attr resize 2000
  163.    lvuse #this 1
  164.    lvdir disks
  165.    setwintitle #this 'Disks'
  166.  
  167. XBUTTON 206 24 20 12 "S"
  168.     gadhelp 'Select/Unselect all items'
  169.    gadid 50
  170.     attr resize 2000
  171.    lvuse #this 1
  172.    if $selswitch = 1
  173.       lvdir all
  174.       selswitch = 0
  175.    else
  176.       lvdir none
  177.       selswitch = 1
  178.    endif
  179.  
  180. XBUTTON 206 36 20 12 "X"
  181.     gadhelp 'Delete selected files'
  182.     attr resize 2000
  183.     gadid 50
  184.     lvuse #this 1
  185.     lvaction delete ask
  186.  
  187. ; ===============================================================
  188. ;       dir lv - add selected
  189. ; ===============================================================
  190.  
  191. XBUTTON 206 48 20 12 +
  192.     gadhelp    'Add selected to list'
  193.    gadid 50
  194.     attr resize 2000
  195.    lvuse gcsound.gc 1
  196.    lvmulti first
  197.    while $$lv.line > ''            ; skip dirs
  198.    and $$lv.type == DIR
  199.       lvmulti next
  200.    endwhile
  201.    while $$lv.line > ''            ; skip dirs
  202.       if $file H= 'FORM????8SVX'
  203.          lvuse gcsound.gc 10
  204.          lvsearch '$file' ci first ; avoid duplicate entries
  205.          if $$lv.line = ''
  206.             extract file file fname
  207.             rec = '                              '
  208.             rec[0][30] = $fname
  209.             appvar rec '0 64 -1 $file'
  210.             lvadd $rec
  211.          endif
  212.          lvuse gcsound.gc 1
  213.       endif
  214.       lvmulti off
  215.       lvmulti next
  216.    endwhile
  217.  
  218. ; ===============================================================
  219. ;       Store dir
  220. ; ===============================================================
  221.  
  222. XBUTTON 206 60 20 12 "f+"
  223.     gadhelp 'Store current dir into favourites'
  224.     gadid 50
  225.     attr resize 2000
  226.     lvuse #this 1
  227.     dir = $$lv.dir
  228.     lvuse #this 11         ; the dir store
  229.     lvsearch '$dir' cs first
  230.     if $$search.pos > ''
  231.         stop    ; dir already exists..
  232.     endif
  233.     extract dir file dname    ; get the dir name
  234.     lvadd '$dname\t\t\t\t$dir'
  235.  
  236. ; ===============================================================
  237. ;       dir lv - switch to samples lv
  238. ; ===============================================================
  239.  
  240. XBUTTON 206 72 20 12 "Ok"
  241.     gadhelp 'Goto file list'
  242.    gadid 50
  243.     attr resize 2000
  244.     gosub #this SetSampleMode
  245.  
  246. ; ===============================================================
  247. ;       Select lv - buttons
  248. ; ===============================================================
  249.  
  250. XBUTTON 206 0 20 12 "<"
  251.    Gadhelp 'Select samples'
  252.    gadid 2
  253.     attr resize 2000
  254.    gosub #this setdirmode
  255.  
  256. XBUTTON 206 12 20 12 "P"
  257.    Gadhelp 'Play selected samples'
  258.    gadid 2
  259.     attr resize 2000
  260.    gosub gcsound.pop playsamp
  261.  
  262. XBUTTON 206 24 20 12 "?"
  263.    Gadhelp 'Adjust sample'
  264.    gadid 2
  265.     attr resize 2000
  266.    lvuse gcsound.gc 10
  267.    lvmulti first
  268.    if $$lv.line > '' 
  269.       gosub gcsound.set settings '$gcsound.gc/sample'
  270.    endif
  271.  
  272. XBUTTON 206 36 20 12 "U"
  273.    Gadhelp 'Unload all samples'
  274.    gadid 2
  275.     attr resize 2000
  276.    lvuse gcsound.gc 10
  277.    lvmulti all
  278.    setgad gcsound.gc 10 HIDE
  279.    guiwindow gcsound.gc wait
  280.    gosub gcsound.pop unload
  281.    setgad gcsound.gc 10 SHOW
  282.    guiwindow gcsound.gc resume
  283.    lvmulti none
  284.  
  285. XBUTTON 206 48 20 12 "R"
  286.    Gadhelp 'Remove selected from list'
  287.    gadid 2
  288.     attr resize 2000
  289.    gosub gcsound.pop remove
  290.  
  291. XBUTTON 206 60 20 12 "L"
  292.    Gadhelp 'Load new list'
  293.    gadid 2
  294.     attr resize 2000
  295.    local loadname
  296.    loadname = ''
  297.    ReqFile -1 -1 300 -40 'Load list:' LOAD loadname #$prefs
  298.    if $loadname > ''
  299.       lvuse #this 10
  300.       lvchange $loadname
  301.       prefs = $loadname
  302.    endif
  303.  
  304. XBUTTON 206 72 20 12 "S"
  305.    Gadhelp 'Save list'
  306.    gadid 2
  307.     attr resize 2000
  308.    local savename
  309.    savename = ''
  310.    ReqFile -1 -1 300 -40 'Save list:' SAVE savename #$prefs
  311.    if $savename > ''
  312.       lvuse #this 10
  313.       lvsave $savename
  314.    endif
  315.  
  316. ; ===============================================================
  317. ;       ROUTINE - Split the line into it's components
  318. ; ===============================================================
  319.  
  320. xRoutine splitline line
  321.    ; split the line into it's components
  322.  
  323.    origline = '$line'   ; store original line
  324.    parsevar line
  325.  
  326.    ; get name & mode
  327.    name = $$parse.0
  328.    if $name[0][5] = ''
  329.       status = LOAD
  330.       name = $name[5]
  331.    elseif $name[0][7] = ''
  332.       status = PLAY
  333.       name = $name[7]
  334.    else
  335.       status = IDLE
  336.    endif
  337.    extract name clean name
  338.  
  339.    times  = $$parse.1
  340.    extract times clean times
  341.    volume = $$parse.2
  342.    extract volume clean volume
  343.    speed  = $$parse.3
  344.    extract speed clean speed
  345.    path = $$parse.4
  346.    extract path clean path
  347.  
  348.    if $setwin = OPEN
  349.       gosub gcsound.set initsetgads
  350.    endif
  351.  
  352. ; ===============================================================
  353. ;       ROUTINE - Join the line & put it back in the list
  354. ; ===============================================================
  355.  
  356. xRoutine joinline
  357.    rec = '                              '
  358.    rec[0][30] = $name
  359.    appvar rec '$times $volume $speed $path'
  360.  
  361.    ; add esc seq
  362.    if $status = PLAY
  363.       rec = '$rec'
  364.    elseif $status = LOAD
  365.       rec = '$rec'
  366.    endif
  367.  
  368. ; ===============================================================
  369. ;       ROUTINE - find line place & put it
  370. ; ===============================================================
  371.  
  372. xRoutine putline
  373.    ; look for old line & replace it
  374.  
  375.    lvuse gcsound.gc 10
  376.    lvsearch '$path' ci first
  377.    if $$lv.line > ''
  378.       lvput '$rec'
  379.    else
  380.       ezreq 'Sample $name was removed!' OK ''
  381.    endif
  382.  
  383. ; ===============================================================
  384. ;       ROUTINE - Set gui looks
  385. ; ===============================================================
  386.  
  387. xRoutine SetDirMode              ; Set dir lv mode
  388.     setgad gcsound.gc 1  SHOW
  389.     setgad gcsound.gc 50  SHOW
  390.     setgad gcsound.gc 10 HIDE
  391.     setgad gcsound.gc 2 HIDE
  392.     redraw gcsound.gc
  393.     gcsound.gc/mode = DIR
  394.     lvuse gcsound.gc 1
  395.     if $$lv.dir > ''
  396.         setwintitle gcsound.gc '$$lv.dir'
  397.     else
  398.         setwintitle gcsound.gc 'Disks'
  399.     endif
  400.     ; lvuse gcsound.gc 10
  401.     ; lvmulti all
  402.     ; gosub gcsound.pop abort    ; abort all playing sounds
  403.  
  404. xRoutine SetSampleMode
  405.    gcsound.gc/mode = SAMPLE
  406.    setgad gcsound.gc 10 SHOW               ; show the samples lv
  407.    setgad gcsound.gc 2 SHOW                ; show the textin gad
  408.    setgad gcsound.gc 1  HIDE               ; hide dir lv
  409.    setgad gcsound.gc 50  HIDE              ; hide all dir lv gads
  410.    redraw gcsound.gc
  411.    setwintitle gcsound.gc 'GCSound 8SVX player'
  412.  
  413.  
  414. ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  415. ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  416. ; ###############################################################
  417.  
  418.         NEWFILE gcsound.pop     ; pop-up on RMB - SAMPLE mode
  419.  
  420. ; ###############################################################
  421. ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  422. ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  423.  
  424. WinBig 0 0 80 120 ""
  425. WinType 00001000
  426. winonmouse 30 22 
  427. varpath gcsound.gc
  428.  
  429. xOnRMB 
  430. guiclose #this
  431.  
  432. xOnInactive
  433. guiclose #this
  434.  
  435. ; ===============================================================
  436. ;       Change to dir lv
  437. ; ===============================================================
  438.  
  439. XBUTTON 0 0 0 15 "<< Select"
  440.     guiclose #this
  441.     gosub gcsound.gc setdirmode
  442.  
  443. ; ===============================================================
  444. ;       Play selected sample
  445. ; ===============================================================
  446.  
  447. XBUTTON 0 15 0 15 "Play"
  448.     gadhelp 'Play first selected samples'
  449.     guiclose #this
  450.     gosub gcsound.pop playsamp
  451.  
  452. XRoutine playsamp
  453.     lvuse gcsound.gc 10
  454.     lvmulti first
  455.     while $$lv.line > ''
  456.        gosub gcsound.gc splitline '$sample'
  457.        if $status = LOAD
  458.           call gcsound play $name $times $volume $speed
  459.           status = PLAY
  460.           gosub gcsound.gc joinline
  461.           lvput '$rec'
  462.        elseif $status = IDLE
  463.           call gcsound load $path $name
  464.           call gcsound play $name $times $volume $speed
  465.           status = PLAY
  466.           gosub gcsound.gc joinline
  467.           lvput '$rec'
  468.        endif
  469.        if $$retcode > 0     ; error = audio is full
  470.           lvmulti none
  471.           stop
  472.        endif
  473.        lvmulti off
  474.        lvmulti next
  475.     endwhile
  476.     lvsort ASC
  477.  
  478. ; ===============================================================
  479. ;       stop current/All sample
  480. ; ===============================================================
  481.  
  482. XBUTTON  0 30 60 15 "Stop"
  483.     gadhelp 'Abort selected sample'
  484.     guiclose #this
  485.     lvuse gcsound.gc 10
  486.     gosub #this abort
  487.  
  488. xroutine abort  ; also used below
  489.     lvmulti first
  490.     while $$lv.line > ''
  491.        if $sample[4][1] = ';'
  492.           gosub gcsound.gc splitline '$sample'
  493.           call gcsound stop $name
  494.           status = LOAD
  495.           gosub gcsound.gc joinline
  496.           lvput '$rec'   ; set plain white
  497.        endif
  498.        lvmulti off
  499.        lvmulti next
  500.     endwhile
  501.  
  502. XBUTTON 60 30 20 15 "A"         ; stop all samples
  503.     gadhelp 'Abort all samples'
  504.     guiclose #this
  505.     lvuse gcsound.gc 10
  506.     lvmulti all
  507.     setgad gcsound.gc 10 HIDE       ; for speed
  508.     guiwindow gcsound.gc wait
  509.     gosub #this abort
  510.     setgad gcsound.gc 10 SHOW
  511.     guiwindow gcsound.gc resume
  512.     lvmulti none
  513.  
  514. ; ===============================================================
  515. ;       UnLoad selected samples
  516. ; ===============================================================
  517.  
  518. XBUTTON 0 45 60 15 "Unload"
  519.     gadhelp 'Unload selected samples from memory'
  520.     guiclose #this
  521.     lvuse gcsound.gc 10
  522.     gosub #this unload
  523.  
  524. xRoutine unload
  525.     lvmulti first
  526.     while $$lv.line > ''
  527.        if $sample[0][1] = ''       ; if loaded or playing   
  528.           gosub gcsound.gc splitline '$sample'
  529.           call gcsound unload $name
  530.           status = IDLE
  531.           gosub gcsound.gc joinline
  532.           lvput '$rec'  ; put here for speed
  533.        endif
  534.        lvmulti off
  535.        lvmulti next
  536.     endwhile
  537.  
  538. XBUTTON 60 45 20 15 "A"         ; unload all samples
  539.     gadhelp 'Abort all samples'
  540.     guiclose #this
  541.     lvuse gcsound.gc 10
  542.     lvmulti all
  543.     setgad gcsound.gc 10 HIDE       ; for speed
  544.     guiwindow gcsound.gc wait
  545.     gosub #this unload
  546.     setgad gcsound.gc 10 SHOW
  547.     guiwindow gcsound.gc resume
  548.     lvmulti none
  549.  
  550. ; ===============================================================
  551. ;       Load selected samples
  552. ; ===============================================================
  553.  
  554. XBUTTON 0 60 0 15 "Load"
  555.     gadhelp 'Load selected samples into memory for fast starting..'
  556.     guiclose #this
  557.     lvuse gcsound.gc 10
  558.     lvmulti first
  559.     while $$lv.line > ''
  560.        gosub gcsound.gc splitline '$sample'
  561.        if $status = IDLE
  562.           call gcsound load '$path' '$name'
  563.           lvput '$sample'
  564.        endif
  565.        lvmulti off
  566.        lvmulti next
  567.     endwhile
  568.  
  569.  
  570. ; ===============================================================
  571. ;       Settings
  572. ; ===============================================================
  573.  
  574. XBUTTON 0 75 0 15 "Settings"
  575.     lvuse gcsound.gc 10
  576.     lvmulti first
  577.     if $$lv.line > '' 
  578.        gosub gcsound.set settings '$gcsound.gc/sample'    ; set vol, speed etc
  579.     endif
  580.  
  581. ; ===============================================================
  582. ;       remove sample
  583. ; ===============================================================
  584.  
  585. XBUTTON 0 90 0 15 "Remove"
  586.     gadhelp 'Unload and remove selected samples from list'
  587.     guiclose #this
  588.     gosub #this remove
  589.  
  590. xroutine remove
  591.     lvuse gcsound.gc 10
  592.     lvmulti first
  593.     while $$lv.line > ''
  594.        if $sample[0][1] = ''
  595.           gosub gcsound.gc splitline '$sample'
  596.           call gcsound unload $name
  597.        endif
  598.        lvdel -1
  599.        lvmulti next
  600.     endwhile
  601.  
  602. ; ===============================================================
  603. ;       quit
  604. ; ===============================================================
  605.  
  606. XBUTTON 0 105 0 15 "Quit"
  607.     gadhelp 'Stop all sounds and quit'
  608.     guiclose #this
  609.     ezreq 'Quit GCSound ?' Quit|CANCEL choice
  610.     if $choice = 1
  611.        GuiQuit gcsound.gc
  612.     endif
  613.  
  614.  
  615. ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  616. ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  617. ; ###############################################################
  618.  
  619.         NEWFILE gcsound.dirpop   ; pop-up on RMB - DIR mode
  620.  
  621. ; ###############################################################
  622. ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  623. ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  624.  
  625. WinBig 0 0 80 90 ""
  626. WinType 00001000
  627. winonmouse 30 22 
  628. varpath gcsound.gc
  629.  
  630. xOnRMB 
  631.     guiclose #this
  632.  
  633. xOnInactive
  634.     guiclose #this
  635.  
  636. xBefore
  637.     guiclose #this
  638.  
  639. ; ===============================================================
  640. ;   Stop sounds
  641. ; ===============================================================
  642.  
  643. XBUTTON 0 0 0 15 "Stop"
  644.     gadhelp 'Stop & unload all sounds'
  645.     call gcsound stop ; stop all sounds
  646.     ifexists port HIPPOPLAYER
  647.         sendrexx HIPPOPLAYER EJECT
  648.         sendrexx HIPPOPLAYER CLEAR
  649.     endif
  650.  
  651. ; ===============================================================
  652. ;   Choose from favourites
  653. ; ===============================================================
  654.  
  655. XBUTTON 0 15 0 15 "Fav"
  656.     gadhelp 'Choose dir from favourites list'
  657.     lvuse gcsound.gc 11
  658.     lvgo first
  659.     lvclip copy -1 paste gcsound.gc 1
  660.     lvuse gcsound.gc 1
  661.     lvmode multi
  662.     gcsound.gc/FAVFLAG = 1
  663.     setgad gcsound.gc 50 on
  664.  
  665. XBUTTON 0 30 0 15 ""
  666. XBUTTON 0 45 0 15 ""
  667. XBUTTON 0 60 0 15 ""
  668.  
  669. XBUTTON 0 75 0 15 "Quit"
  670.     gadhelp 'Stop all sounds and quit'
  671.     ezreq 'Quit GCSound ?' Quit|CANCEL choice
  672.     if $choice = 1
  673.        GuiQuit gcsound.gc
  674.     endif
  675.  
  676. ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  677. ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  678. ; ###############################################################
  679.  
  680.         NEWFILE gcsound.set     ; pop-up on dblclk - SAMPLE mode
  681.  
  682. ; ###############################################################
  683. ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  684. ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  685.  
  686. WINBIG 26 32 302 88 gcsound.set
  687. WinType 11110001
  688. varpath gcsound.gc
  689. BOX 0 0 0 0 out button
  690.  
  691. xOnOpen
  692.     setwin = OPEN
  693.  
  694. xOnClose
  695.     setwin = CLOSED
  696.  
  697. ; ===============================================================
  698. ;       the routine that gets called
  699. ; ===============================================================
  700.  
  701. xroutine settings sample
  702.     guiopen #this
  703.     setgad #this 43 on              ; set on play button (if it was off)
  704.  
  705.     gosub gcsound.gc splitline '$sample'
  706.  
  707.     if $status != LOAD              ; play button
  708.        setgad #this 43 OFF
  709.     endif
  710.  
  711.     ; if sample is loaded, get actual values
  712.     if $status != IDLE
  713.        call gcsound info $name
  714.        info = $$call.ret
  715.        cutvar info cut word 1 volume
  716.        extract volume clean volume
  717.        extract info clean speed
  718.     endif
  719.     gosub #this initsetgads
  720.  
  721.  
  722. xRoutine initsetgads    ; also called from gcsound.gc
  723.     update #this 2 $times
  724.     update #this 1 $volume
  725.     update #this 3 $speed
  726.     update #this 31 $speed
  727.     setwintitle #this '$name'
  728.  
  729.     ; init speed gads
  730.     if $speed = -1
  731.        update #this 32 1
  732.        setgad #this 3  OFF
  733.        setgad #this 31 OFF
  734.        usedef = ON
  735.     else
  736.        update #this 32 0
  737.        setgad #this 31 ON
  738.        setgad #this 3  ON
  739.        usedef = OFF
  740.     endif
  741.  
  742. ; ===============================================================
  743. ;       volume
  744. ; ===============================================================
  745.  
  746. CTEXT 15 3 "Volume (0-64):" #screen 8 2 0 "0001"
  747. XHSLIDER 9 15 254 12 "" volume 0 64 64 "%ld"
  748.     gadid 1
  749.     call gcsound volume $name $volume
  750.     gosub gcsound.gc joinline
  751.     gosub gcsound.gc putline
  752.  
  753. ; ===============================================================
  754. ;       times (doesn't work well yet..)
  755. ; ===============================================================
  756.  
  757. CTEXT 15 27 "Times (0=forever):" #screen 8 2 0 "0001"
  758. XHSLIDER 9 39 254 12 "" times 0 100 0 "%ld"
  759.     gadid 2
  760.     call gcsound times $name $times
  761.     gosub gcsound.gc joinline
  762.     gosub gcsound.gc putline
  763.  
  764. ; ===============================================================
  765. ;       speed
  766. ; ===============================================================
  767.  
  768. CTEXT 15 57 "Speed:" #screen 8 2 0 "0001"
  769.  
  770. ; ============== textin gad
  771.  
  772. XTEXTIN 69 54 83 14 "" speed "214" 100
  773.     gadid 31
  774.     if $speed > 124
  775.     and $speed < 301
  776.         setgad #this 3 ON
  777.         update #this 3 $speed
  778.     else
  779.         setgad #this 3 OFF
  780.     endif
  781.     call gcsound speed $name $speed
  782.     gosub gcsound.gc joinline
  783.     gosub gcsound.gc putline
  784.  
  785. ; ============== checkbox
  786.  
  787. XCHECKBOX 234 57 26 11 "Default" usedef ON OFF ON
  788.     gadid 32
  789.     if $usedef = ON
  790.        oldspeed = $speed
  791.        speed = -1
  792.        call gcsound speed $name -1
  793.        setgad #this 3 OFF           ; set slider off        
  794.        setgad #this 31 OFF          ; set textin off        
  795.     else 
  796.        speed = $oldspeed
  797.        call gcsound speed $name $speed
  798.        setgad #this 3 ON            ; set slider on 
  799.        setgad #this 31 ON           ; set textin on
  800.     endif
  801.     gosub gcsound.gc joinline
  802.     gosub gcsound.gc putline
  803.  
  804. ; ============== slider
  805.  
  806. XHSLIDER 9 69 254 12 "" speed 125 300 214 "%ld"
  807.     gadid 3
  808.     update #this 31 $speed
  809.     call gcsound speed $name $speed
  810.     gosub gcsound.gc joinline
  811.     gosub gcsound.gc putline
  812.  
  813.  
  814.  
  815.  
  816.